﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Core;

namespace DAL
{
    public class StudentNoteProblemCommentDAL : SyncBase<Model.StudentNoteProblemComment>
    {
        static StudentNoteProblemCommentDAL()
        {
            StringBuilder strSql = new StringBuilder();
            StudentNoteProblemCommentDAL.addSQL = @"insert into TempStudentNoteProblemComment(
PnoteID,ReplyerID,ReplyType,ReplyContent,ReplyConURL,ReplyTime)
 values (
@PnoteID,@ReplyerID,@ReplyType,@ReplyContent,@ReplyConURL,@ReplyTime)";
            StudentNoteProblemCommentDAL.tbName = "TempStudentNoteProblemComment";
            StudentNoteProblemCommentDAL.remoteUrl = "/Ayyfford/AddStudentNoteProblemComment";
            StudentNoteProblemCommentDAL.setVal = (lt) =>
            {
                StringBuilder sb = new StringBuilder();
                string _ids = string.Empty;
                if (lt != null && lt.Count > 0)
                {
                    lt.ForEach(t =>
                    {
                        _ids += t.ID + ",";
                        sb.AppendFormat("({0}, {1}, {2}, {3}, {4}, {5}),",
                          t.PnoteID.NullNumber(), t.ReplyerID.NullNumber(), t.ReplyType.NullNumber(), t.ReplyContent.NullString(), t.ReplyConURL.NullString(), t.ReplyTime.NullDate());
                    });
                }
                return new Tuple<string, string>(sb.ToString(), _ids);
            };
        }

        new public static void SaveEntity(Model.StudentNoteProblemComment t)
        {
            SyncBase<Model.StudentNoteProblemComment>.SaveEntity(t);
        }

        new public static void AsyncData()
        {
            SyncBase<Model.StudentNoteProblemComment>.AsyncData();
        }
    }
}
